package com.nineclock.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nineclock.system.pojo.SysRole;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;


public interface SysRoleMapper extends BaseMapper<SysRole> {

    @Select("select \n" +
            "r.*\n" +
            "from \n" +
            "sys_company_user cu , sys_company_user_role ur , sys_role r \n" +
            "where \n" +
            "cu.id = ur.company_user_id and ur.role_id = r.id \n" +
            "and cu.user_id = #{userId} and cu.company_id = #{companyId}")
    public List<SysRole> queryRoleByUserIdAndCompanyId(@Param("userId") Long userId, @Param("companyId") Long companyId);

}
